-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Make sure fmt-write-bloat
doesn't vacuously pass on no symbols
#143669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors2 try jobs=x86_64-msvc-* |
Make sure `fmt-write-bloat` doesn't vacuously pass on no symbols Previously, the test only checks for the absence of certain panic symbols, but having no symbols was also a possible albeit vacuous way to satisfy this assertion. Fix this by checking we at least observe the `main` symbol which is always expected to be present. Noticed in #142841 (comment). r? `@ChrisDenton` try-job: x86_64-msvc-*
💔 Test failed
|
Hm. Let me try this locally on windows. |
The failure is not surprising to me. On Windows, symbols are not contained in the binary itself and are instead in a separate file (the .pdb). So the |
Oh of course... D'oh. Let me see if I can cook something up. |
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
fmt-write-bloat
doesn't vacuously pass on no symbolsfmt-write-bloat
doesn't vacuously pass on no symbols
@bors2 try |
[WIP] Make sure `fmt-write-bloat` doesn't vacuously pass on no symbols Previously, the test only checks for the absence of certain panic symbols, but having no symbols was also a possible albeit vacuous way to satisfy this assertion. Fix this by checking we at least observe the `main` symbol which is always expected to be present. Noticed in #142841 (comment). r? `@ChrisDenton` try-job: aarch64-apple try-job: x86_64-apple-1 try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1
|
I bet this will also fail on apple because |
I forgor to run this locally, it's |
Try build cancelled. Cancelled workflows: |
Oh. Apparently we have both @bors2 try |
[WIP] Make sure `fmt-write-bloat` doesn't vacuously pass on no symbols Previously, the test only checks for the absence of certain panic symbols, but having no symbols was also a possible albeit vacuous way to satisfy this assertion. Fix this by checking we at least observe the `main` symbol which is always expected to be present. Noticed in #142841 (comment). r? `@ChrisDenton` try-job: aarch64-apple try-job: x86_64-apple-1 try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1
Previously, the test only checks for the absence of certain panic symbols, but having no symbols was also a possible albeit vacuous way to satisfy this assertion. Fix this by checking we at least observe the `main` symbol which is always expected to be present.
b63f2b1
to
24830de
Compare
@bors2 try |
[WIP] Make sure `fmt-write-bloat` doesn't vacuously pass on no symbols Previously, the test only checks for the absence of certain panic symbols, but having no symbols was also a possible albeit vacuous way to satisfy this assertion. Fix this by checking we at least observe the `main` symbol which is always expected to be present. Noticed in #142841 (comment). r? `@ChrisDenton` try-job: aarch64-apple try-job: x86_64-apple-1 try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1
Assorted `run-make-support` maintenance This PR should contain no functional changes. - Commit 1: Removes the support library's CHANGELOG. In the very beginning, I thought maybe we would try to version this library. But this is a purely internal test support library, and it's just extra busywork trying to maintain changelog/versions. It's also hopelessly outdated. - Commit 2: Resets version number to `0.0.0`. Ditto on busywork. - Commit 3: Bump `run-make-support` to Edition 2024. The support library was already "compliant" with Edition 2024. - Commit 4: Slightly organizes the support library dependencies. - Commit 5: Previously, I tried hopelessly to maintain some manual formatting, but that was annoying because it required skipping rustfmt (so export ordering etc. could not be extra formatted). Give up, and do some rearrangements / module prefix tricks to get the `lib.rs` looking at least *reasonable*. IMO this is not a strict improvement, but I rather regain the ability to auto-format it with rustfmt. - Commit {6,7}: Noticed in rust-lang#143669 that we apparently had *both* {`is_msvc`, `is_windows_msvc`}. This PR removes `is_msvc` in favor of `is_windows_msvc` to make it unambiguous (and only retain one way of gating) as there are some UEFI targets which are MSVC but not Windows. Best reviewed commit-by-commit. r? `@Kobzol`
fmt-write-bloat
doesn't vacuously pass on no symbolsfmt-write-bloat
doesn't vacuously pass on no symbols
Try jobs are green. |
Re. the |
My only concern with the I'm not going to insist on it on this PR but I think long term it would be good to use official debugging APIs on Windows hosts and only fallback to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this some more, maybe a more robust way to do this test is to compile two programs: one with the symbols and one without. That would guard against, e.g. changing symbol names or different kinds of naming conventions.
assert!(any_symbol_contains(bin_name("main"), &["main"])); | ||
assert!(!any_symbol_contains(bin_name("main"), &panic_syms)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, I know this is pre-existing but why is this bin_name
? That should be a no-op on unix targets but main.exe
on Windows, which sounds weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just because the underlying helper uses fs::read
, which doesn't try to account for .exe
or not.
Ah, did you mean the Debug Interface Access SDK? |
Yeah. But I mean, figuring out how to use it is perhaps more work then you signed up for 😉. |
Hm yeah. I think in the long-term, we should probably be using DIA wrappers (but that's quite a bit of Windows-specific work). In the short-term, I could also fallback to just using EDIT: #143737 |
Let me try the
approach. @rustbot author |
Rollup merge of #143683 - jieyouxu:rms-cleanup, r=Kobzol Assorted `run-make-support` maintenance This PR should contain no functional changes. - Commit 1: Removes the support library's CHANGELOG. In the very beginning, I thought maybe we would try to version this library. But this is a purely internal test support library, and it's just extra busywork trying to maintain changelog/versions. It's also hopelessly outdated. - Commit 2: Resets version number to `0.0.0`. Ditto on busywork. - Commit 3: Bump `run-make-support` to Edition 2024. The support library was already "compliant" with Edition 2024. - Commit 4: Slightly organizes the support library dependencies. - Commit 5: Previously, I tried hopelessly to maintain some manual formatting, but that was annoying because it required skipping rustfmt (so export ordering etc. could not be extra formatted). Give up, and do some rearrangements / module prefix tricks to get the `lib.rs` looking at least *reasonable*. IMO this is not a strict improvement, but I rather regain the ability to auto-format it with rustfmt. - Commit {6,7}: Noticed in #143669 that we apparently had *both* {`is_msvc`, `is_windows_msvc`}. This PR removes `is_msvc` in favor of `is_windows_msvc` to make it unambiguous (and only retain one way of gating) as there are some UEFI targets which are MSVC but not Windows. Best reviewed commit-by-commit. r? `@Kobzol`
☔ The latest upstream changes (presumably #143731) made this pull request unmergeable. Please resolve the merge conflicts. |
|
||
fn main() { | ||
rustc().input("main.rs").opt().run(); | ||
// panic machinery identifiers, these should not appear in the final binary | ||
let mut panic_syms = vec!["panic_bounds_check", "Debug"]; | ||
let mut panic_syms = vec![sym("panic_bounds_check"), sym("Debug")]; | ||
if no_debug_assertions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: while investigating this test, I realized this is actually incorrect (even in the original Makefile
version), and the port preserved the incorrect gating
# Allow for debug_assert!() in debug builds of std.
ifdef NO_DEBUG_ASSERTIONS
PANIC_SYMS += panicking panic_fmt pad_integral Display Debug
endif
I believe NO_DEBUG_ASSERTIONS
corresponds (confusingly) only to whether rustc has debug assertions enabled, not std.
I have a separate PR that I'll send first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusting the |
…Denton Disambiguate between rustc vs std having debug assertions in `run-make-support` and `run-make` tests `NO_DEBUG_ASSERTIONS` is set by CI that threads through to the `./configure.py` script, which is somewhat fragile and "spooky action at a distance". For `fmt-write-bloat`, this is actually wrong because the test wants to gate on *std* being built with debug assertions or not, whereas `NO_DEBUG_ASSERTIONS` determines *rustc* being built with debug assertions or not. Instead, use env vars controlled by compiletest, whose debug assertion info comes from bootstrap. https://github.com/rust-lang/rust/blob/855e0fe46e68d94e9f6147531b75ac2d488c548e/src/ci/run.sh#L137-L146 `NO_DEBUG_ASSERTIONS` controls `--enable-debug-assertions` https://github.com/rust-lang/rust/blob/855e0fe46e68d94e9f6147531b75ac2d488c548e/src/bootstrap/configure.py#L124 which sets `--rust.debug-assertions`, which controls *rustc* debug assertions. https://github.com/rust-lang/rust/blob/855e0fe46e68d94e9f6147531b75ac2d488c548e/src/bootstrap/configure.py#L125-L129 `--rust.debug-assertions-std` controls *std* debug assertions. Noticed while investigating `fmt-write-bloat` in rust-lang#143669 (comment). Best reviewed commit-by-commit. r? `@ChrisDenton` (or compiler/bootstrap)
This PR fixes the
tests/run-make/fmt-write-float/
run-make test to both (1) not vacuously pass on no symbols at all, and (2) actually check aginst the platform-specific decorated panic symbols.run-make-support
library to allow us to programmatically inspect PDB files, instead of trying to perform textual output matching onllvm-pdbutil
whose textual output is not necessarily guaranteed to remain the same between versions.main
symbol and isn't completely devoid of symbols, and also fixes the negative check against panic machinery symbols to account for platform differences.Context
Previously, the test only checks for the absence of certain panic symbols, but having no symbols was also a possible albeit vacuous way to satisfy this assertion.
Fix this by checking we at least observe the
main
symbol which is always expected to be present.Noticed in #142841 (comment).
r? @ChrisDenton
try-job: aarch64-apple
try-job: x86_64-apple-1
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1